<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>店面产品</title>
<meta name="decorator" content="default" />
<style type="text/css">
</style>
<script type="text/javascript">
	$()
			.ready(
					function() {
						loadingEmpoyees(document.getElementById("employeeProductID"), '');
						buyProducts
								.loadingProductList("#selectProduct", "self");
						buyProducts
								.registerSubmitHandler("storeProduct.storeSelfProduct.name");
						buyProducts.registerEditSelection();
						disableExitMenu();
					});
</script>
</head>
<body>
	<div class="container">
		<tags:message content="${message}" />
		<table id="contentTable" data-role="table"
			class="ui-responsive table-stroke">
			<thead>
				<tr>
					<th colspan="5" style="text-align:center;">已选产品</th>
				</tr>
				<tr>
					<th>产品名称</th>
					<th>产品规格</th>
					<th>数量</th>
					<th>零售价</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody id="tbody">
				<c:forEach items="${member.shoppingCart.storeProducts}"
					var="productCart">
					<tr id="${productCart.storeProduct.id}"
						name="${productCart.storeProduct.storeSelfProduct.name}"
						spec="${productCart.storeProduct.storeSelfProduct.spec}"
						amount="${productCart.count}"
						price="${productCart.storeProduct.storeSelfProduct.retail_price}">
						<td>${productCart.storeProduct.storeSelfProduct.name}</td>
						<td>${productCart.storeProduct.storeSelfProduct.spec}</td>
						<td id="amount">${productCart.count}</td>
						<td>${productCart.storeProduct.storeSelfProduct.retail_price}</td>
						<td><a data-role="button" data-inline="true"
							data-icon="delete" data-iconpos="notext"
							onclick="buyProducts.deleteTr('确定删除产品：${productCart.storeProduct.storeSelfProduct.name}?','${productCart.storeProduct.id}','self')">删除</a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div class="pagination">${page}</div>
		<form:form id="inputForm" modelAttribute="storeProduct">
			<form:hidden path="storeProduct.id" id="productID" />
			<input type="hidden" id="type" name="type" value="self" />
			<input type="hidden" id="editing" name="editing" value="add" />
			<input type="hidden" id="currentAmount" name="currentAmount"
				value="0" />
			<div data-role="fieldcontain" id="selectionfields">
				<label>产品名称:</label>
				<form:input type="text" id="productName" readonly="true"
					path="storeProduct.storeSelfProduct.name" class="required" />
				<a id="selectButton" href="#selectProduct" data-rel="popup"
					data-role="button" data-inline="true" data-icon="plus"
					data-position-to="window" data-transition="pop">选择产品</a>
			</div>

			<div data-role="fieldcontain">
				<label>产品规格</label>
				<form:input path="storeProduct.storeSelfProduct.spec" type="text"
					id="productSpec" readonly="true" />
			</div>
			<div data-role="fieldcontain">
				<label>零售价格</label>
				<form:input path="storeProduct.storeSelfProduct.retail_price"
					type="text" id="productRetailPrice" readonly="true" />

			</div>
			<div data-role="fieldcontain">
				<label>购买数量</label>
				<form:input path="count" type="text" />
			</div>
			<div data-role="fieldcontain">
				<label>服务专员:</label>
				<form:select id="employeeProductID" path="employee.id"
					name="employeeProductID">
				</form:select>
			</div>
			<div class="icon-buttons">
				<input type="button" data-inline="true" data-icon="check"
					onclick="return directOpenURL('${ctx}/cash/member/product?id=${member.customer.id}')"
					data-iconpos="notext" value="返回" />
			</div>
			<div id="okbutton">
				<button type="submit" data-inline="true">确认添加</button>
			</div>
		</form:form>
	</div>
</body>
</html>
